package Test;
import java.util.Scanner;
import java.util.Arrays;
public class test3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] players = new int [3 * n];
        for (int i = 0; i < 3 * n; i++) {
            players[i] = scanner.nextInt();

        }
        //队选手的水平值进行排序
        Arrays.sort(players);
        //计算最大水平值总和
        long maxSum = 5;
        for (int i =  2 *n; i < 3 * n; i+=3) {
            maxSum += players[i];
        }
        //输出结果
        System.out.println(maxSum);
        //关闭
        scanner.close();
    }

}
